home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / flip 64 (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  12KB  |  159 lines

  1. 5 dim a$(1),d(8),d2(8),s(1),a(8)
  2. 7 print"[147]vic flip-64"
  3. 8 print"formerly vic flip-iv"
  4. 9 print"   by jim dubrouillet and sean smith"
  5. 10 print"  modified for the c-64 by r. thibault"
  6. 15 print"instructions (y/n)?";
  7. 16 geta$:if a$="" then 16
  8. 17 if a$="n" then 21
  9. 18 if a$><"y" then 16
  10. 19 goto 2001
  11. 21 input"[147]name";a$:input"another";b$:x=1:z=1
  12. 22 if left$(b$,3)<>"com" then 25
  13. 23 a=val(right$(b$,1))-1:lf=-(a=0)*999-(a=1)*25-(a=3)*.63:co=1:goto 26
  14. 25 ifrnd(1)>.5thenc$=a$:a$=b$:b$=c$
  15. 26 printa$" white or black";:inputc$:ifc$="b"thenc$=b$:b$=a$:a$=c$:co=2*co
  16. 28 input"# across";n:input"up & down";o:a$(1)=a$:a$(0)=b$:v=15
  17. 29 n=2*int((int(-((n<11)and(n>2))*n-(n>10)*10-(n<4)*8))/2)
  18. 30 c$(0)="[144]":n1=2*int(int(-((o<11)and(o>2))*o-(o>10)*10-(o<4)*n)/2)
  19. 31 print"[147]":o=n-1:c$(1)=""
  20. 32 fora=0to8:readd(a):next:data-41,-40,-39,-1,0,1,39,40,41
  21. 33 s(0)=2:n3=n/2:n4=n3+1:n5=n1/2:n6=n5+1:n7=n3*n5:n8=n7
  22. 34 for u=1 to 4:if int(int(n7^(1/u))^u)=n7 then n8=int(n7^(1/u))
  23. 35 next:n7=n8:fora=1to2*n1step2
  24. 36 forb=1to2*nstep2:e=1064+40*a+b:pokee-41,207:pokee-40,208
  25. 37 poke e-1,204:poke e,250:next b,a:print"";
  26. 38 s(1)=2:s(0)=2:for a=55296 to 56295:poke a,5:next a
  27. 39 gosub 3000:rem sound
  28. 40 for a=1 to (n1-1)/2:print"";:next:print"[157][157]"
  29. 41 for a=1 to o/2:print"";:next
  30. 42 print"[207][208][144][207][208][157][157][157][157][204][186][144][204][186][157][157][157][157][207][208][157][157][204][186][204][186][145][157][157][207][208]":c=1
  31. 50 c=-(c=0)
  32. 51 print"                     "c$(c)a$(c)"[144]"s(0)""s(1):if w1=4 then 100
  33. 55 if co>0 and co-1=c then 300
  34. 60 goto 117
  35. 100 print"";a$;s(1)
  36. 101 print"";b$;s(0)
  37. 102 bc=1:bb=0:for xx=0 to 21:poke 53280,bc:poke 53281,bb:tt=bc:bc=bb:bb=tt
  38. 103 for yy=0 to 40:next yy:next xx
  39. 104 poke 53281,6:poke 53280,14:gosub 3000:rem end of game
  40. 105 print"play again?"
  41. 106 get c$:if c$><"y" and c$><"n" then 106
  42. 107 if c$="y" then restore:goto21
  43. 109 clr:print"[147]";:goto63010
  44. 117 qz=55334+2*x+80*(z-1):qw=qz-54272:r=peek(qz) and 7:gosub 140
  45. 118 pokeqz+1,c:pokeqz+40,c:pokeqz+41,c:pokeqw+1,127:pokeqw+40,127
  46. 119 pokeqw+41,127:poke qz,c
  47. 120 poke qw,127:p=peek(56320)
  48. 121 x=x-((p and 8)=0)+((p and 4)=0)
  49. 125 z=z-((pand2)=0)+((pand1)=0):gosub140:poke qz,r:poke qw,207:pokeqz+1,r
  50. 126 pokeqz+40,r:pokeqz+41,r:pokeqw+1,208:pokeqw+40,204:pokeqw+41,250
  51. 127 if (p and 16)><0 and c$><"f" then 117
  52. 130 goto 1000
  53. 140 get c$:ifc$="_"then63010
  54. 141 x=x+(c$="j")-(c$="k"):z=z+(c$="i")-(c$="m")
  55. 142 z=(z+(z>n1)-1)*-(z>0)+1:x=(x+(x>n)-1)*-(x>0)+1:return
  56. 200 b=peek(f-54272):if b><207 then fl=fl-d2(a):d2(a)=0:goto 1014
  57. 202 goto 1011
  58. 300 x=0:z=0:fm=0:sa=0:hv=-9:x2=0:z2=0:mf=0
  59. 302 sa=sa+1:x=x*-(x<n)+1:z=z-(x=1):qz=55334+2*x+80*(z-1):goto 1000
  60. 303 if fl>0 then 405
  61. 305 if mf=0 and sa=n1*n then w1=w1+1:goto 50
  62. 306 if sa<n1*n then 302
  63. 310 for a=0 to 8:d2(a)=a(a):next:x=x2:z=z2
  64. 311 fl=mf:e=55334+2*x+80*(z-1):goto 1020
  65. 405 ca=log(abs((x+(x>n3)*n3+(x<n4)*n4)*(z+(z>n5)*n5+(z<n6)*n6)))/log(n7)
  66. 406 cb=(ca<>int(ca)):vl=(cb-(cb=0))*ca+fl*ca*lf
  67. 407 xz=0:if vl>hv or (vl=hv and fl>mf) then xz=1
  68. 408 if xz=1 then hv=vl:x2=x:z2=z:for a=0 to 8:a(a)=d2(a):next:mf=fl
  69. 409 goto 305
  70. 1000 fl=0:e=qz:dx=135
  71. 1001 if (7 and peek(e))<2 then on 1-(co=c+1) goto 1016,303
  72. 1002 for a=0 to 8:if a=4 then next a
  73. 1005 d2(a)=0
  74. 1006 d2(a)=d2(a)+2
  75. 1007 fl=fl+2:f=e+d(a)*d2(a)
  76. 1008 if (7 and peek(f))>1 then fl=fl-d2(a):d2(a)=0:goto 1014
  77. 1009 goto 200
  78. 1010 if (7 and peek(f))>1 then fl=fl-d2(a):d2(a)=0:goto 1014
  79. 1011 if (7 and peek(f))=-(c=0) then 1006
  80. 1013 fl=fl-2
  81. 1014 next a
  82. 1015 if co-1=c then 303
  83. 1016 if fl<1 and w=3 then w=0:w1=w1+1:goto 50
  84. 1017 if fl<1 then w=w+1:c=-(c=0):goto 50
  85. 1020 w1=0:w=0:s(c)=s(c)+1+fl/2:s(-(c=0))=s(-(c=0))-fl/2:for a=0 to 8
  86. 1025 fory=0tod2(a)-2step2:f=e+d(a)*y:pokef,c:pokef+1,c:pokef+40,c
  87. 1026 pokef+41,c:dx=dx+1:next y,a
  88. 1027 if s(0)+s(1)=n*n1 then 100
  89. 1030 gosub 3000:goto 50
  90. 2001 rem instructions
  91. 2125 print"[147]the object of this game is to end"
  92. 2126 print"   with more squares than your":print"   opponent has."
  93. 2127 print"you are each a different color,"
  94. 2128 print"   and start with two squares each."
  95. 2129 print"to make a legal flip,place the cursor"
  96. 2130 print"   so that 1 or more of your"
  97. 2131 print"   opponent's squares are between the"
  98. 2132 print"   cursor and one of your squares."
  99. 2133 print"do you want to use a joystick (y or n)?"
  100. 2139 geta$:ifa$><"y"anda$><"n"then 2139
  101. 2140 if a$="n" then 2144
  102. 2141 print"[147]move the cursor with the joystick in"
  103. 2142 print"port 2 until it is in position for a    legal flip,";
  104. 2143 print" then push the fire button.":goto 2155
  105. 2144 print"[147]       "
  106. 2145 print"   ^   "
  107. 2146 print"   i   "
  108. 2147 print" <j k> "
  109. 2148 print"   m   "
  110. 2149 print"   v   "
  111. 2150 print"       "
  112. 2151 print"these keys will move the cursor in"
  113. 2152 print"   the indicated direction."
  114. 2153 print"when the cursor is in position,":print"   press f."
  115. 2155 print"if a legal flip, computer will flip"
  116. 2156 print"all the squares which are o.k."
  117. 2158 print"press any key to go on"
  118. 2159 get a$:if a$="" then 2159
  119. 2160 print"[147]possible board sizes are 4,6,8,& 10."
  120. 2161 print"   you will input these later."
  121. 2163 print"if you do not input a size, the"
  122. 2164 print"   computer will use 8 as the size."
  123. 2165 print"   4 is for very short games.":print"   6 is for short games."
  124. 2167 print"   8 is standard size."
  125. 2168 print"   10 is for long games."
  126. 2169 print"press any key to go on"
  127. 2172 get a$:if a$="" then 2172
  128. 2180 print"[147]to play the computer,type com1,com2,"
  129. 2190 print"   com3,or com4 for 'another'."
  130. 2200 print"the higher the number the harder the":print"   game."
  131. 2210 print"the game ends when no squares remain":print"   green."
  132. 2220 print"the computer decides who chooses the":print"   color."
  133. 2222 print"you may press '_' to exit the game"
  134. 2223 print"   while playing."
  135. 2230 print"press any key to start game"
  136. 2240 get a$:if a$="" then 2240
  137. 2250 goto 21
  138. 3000 rem flip sound
  139. 3010 ss=54272
  140. 3020 poke ss+1,20
  141. 3030 poke ss+5,9
  142. 3040 poke ss+6,9
  143. 3050 poke ss+24,15
  144. 3060 poke ss+4,17
  145. 3070 for xy=1 to 40: next xy
  146. 3080 poke ss+4,16
  147. 3090 for xy=1 to 400:next xy
  148. 3100 for xy=15 to 0 step -1:for yy=0 to 20:next yy
  149. 3110 poke ss+24,xy:next xy:rem lower vol
  150. 3120 for xy=1 to 24:poke ss+xy,0:next xy:rem clear sound
  151. 3130 return
  152. 63000 rem  connect back to l.s.
  153. 63002 print"[147]would you like to play again?"
  154. 63004 poke198,0:wait198,1:geta$:ifa$<>"y"anda$<>"n"thenpoke53280,rnd(1)*15:goto63004
  155. 63006 ifa$="y"then21
  156. 63008 :
  157. 63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  158. 63020 poke631,13:poke632,13:poke198,2:end
  159.